package com.zhaopin.file;

import com.alibaba.fastjson.JSONObject;

import java.io.IOException;

/**
 * @author Administrator
 * @create 2020-02-08 14:42
 */
public class UrlToJson {

    public static void main(String[] args) throws IOException {
        //http://zpsearch.zhaopin.com/position/mbscore?debug=true&gray_router=c_App_s_company_salary_merge
        JSONObject jsonObject = new JSONObject();
        String url = "https://zpsearch.zhaopin.com/pre/position/mbscore?start=0&rows=90&ip=27.187.253.43&client=mobile&deviceId=ffffffff-dbb6-6018-ffff-ffffef05ac4a&userId=1115859743&eventScenario=androidSearchResult&platform=4&S_SOU_FULL_INDEX=%E9%80%81%E8%B4%A7%E5%8F%B8%E6%9C%BA&S_SOU_WORK_CITY=570&S_SOU_EXPAND=SOU_COMPANY_ID&isCompus=0&filterMinSalary=1&cvNumber=JH158597430R90500000000&&&debug.exp=config-position_search-position_mbscore-NOINTENT-c_app_third_rank_ctr&aggregator_router=aggregator&testplatform=1&debug=true&debug.solrUrl=loadbalancer-platform-solr-position-search-seo";
        String[] urlAttr = url.split("&");
        for (String s : urlAttr) {
            String str = s.replaceAll("[?]","");
            String[] urlA = str.split("=");
            if(urlA.length == 2){
                String a = urlA[0];
                String b = urlA[1];
                jsonObject.put(a,b);
            }
        }
        System.out.println(jsonObject.toJSONString());

    }
}
